package AI;

import java.util.LinkedList;
import java.util.List;

import mapControl.Celda;
import mapControl.GraphicsMapControl;

import ED.GraphImp;

import elementos.Player;
import enemies.Enemy;
import enemies.factory.Barracks;
import enemies.factory.builders.AltairEnemyBuilder;
import enemies.factory.builders.EnemyBuilder;
import enemies.factory.builders.RugulusEnemyBuilder;
import enemies.factory.builders.SiruisEnemyBuilder;
import sun.awt.windows.ThemeReader;

public class IA_Bad_Boys extends Thread {
	
	List<Enemy> collectionEnemies;

	private GraphicsMapControl mapControl;
	private Player player;

	public IA_Bad_Boys(GraphicsMapControl mapControl, Player player) {
		this.mapControl = mapControl;
		this.player = player;
		buildEnemy();
		
		for (Enemy e: collectionEnemies)
		{
			Thread t = new Thread(e);  
			t.start();
		}
		
	}

	public List<Enemy> getCollectionEnemies() {
		return collectionEnemies;
	}


	private void buildEnemy() {

		Barracks barracks = new Barracks(mapControl, player);
		EnemyBuilder rugulusEnemyBuilder = new RugulusEnemyBuilder();
		EnemyBuilder altairEnemyBuilder = new AltairEnemyBuilder();
		EnemyBuilder siruisEnemyBuilder = new SiruisEnemyBuilder();

		collectionEnemies = new LinkedList<Enemy>();
		
		barracks.setEnemyBuilder(rugulusEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.setEnemyBuilder(altairEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

		barracks.setEnemyBuilder(siruisEnemyBuilder);

		barracks.construct();
		collectionEnemies.add(barracks.startAndGetEnemy());

	}

}
